arm: reduce power use by contented spin locks with WFE/SEV
authorDavid Vrabel <david.vrabel@citrix.com>
Mon, 3 Aug 2015 11:29:19 +0000 (12:29 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 15 Sep 2015 10:58:47 +0000 (11:58 +0100)
commite625faf45ee1349be7da2b27e38567e01ce4b453
treedcd011a624efae31e6fa7188a14fb80203c53de4
parent7f315c5323bb8185319384ae94bf913d4d15902c
arm: reduce power use by contented spin locks with WFE/SEV

Instead of cpu_relax() while spinning and observing the ticket head,
introduce arch_lock_relax() which executes a WFE instruction.  After
the ticket head is changed call arch_lock_signal() to execute an SEV
instruction (with the required DSB first) to wake any spinners.

This should improve power consumption when locks are contented and
spinning.

For consistency also move arch_lock_(acquire|release)_barrier to
asm/spinlock.h.

Booted the result on arm32 (Midway) and arm64 (Mustang). Build test
only on amd64.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
[ijc: add barrier, rename as arch_lock_*, move arch_lock_*_barrier, test]
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
xen/common/spinlock.c
xen/include/asm-arm/spinlock.h
xen/include/asm-arm/system.h
xen/include/asm-x86/spinlock.h
xen/include/asm-x86/system.h